#define _CRT_SECURE_NO_WARNINGS

#include<stdio.h>

int main()
{
    int n = 0, count = 0;
    scanf("%d", &n);
    int a[100];
    int b[100];

    for (int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
    }

    for (int i = 0; i < n; i++)
    {
        scanf("%d", &b[i]);
    }

    for (int i = 0; i < n; i++)
    {
        
        for (int z = 1; z < n - i; z++)
        {
            int tmp = a[i], cur = b[i];
            for (int j = i + z; j < n; j++)
            {
                tmp += a[j];
                cur += b[j];
                if (cur >= tmp)
                {
                    count++;
                }
            }
        }

    }

    printf("%d", count);
    return 0;
}